﻿<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>查询所有管理员</title>
    <link rel="shortcut icon" href="<%=application.getContextPath()%>/static/favicon.ico">
    <link href="<%=application.getContextPath()%>/static/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="<%=application.getContextPath()%>/static/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">

    <!-- Data Tables -->
    <link href="<%=application.getContextPath()%>/static/css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">

    <link href="<%=application.getContextPath()%>/static/css/animate.min.css" rel="stylesheet">
    <link href="<%=application.getContextPath()%>/static/css/style.min.css?v=4.0.0" rel="stylesheet">

</head>

<body class="gray-bg">
<c:if test="${deleteMsg != null && !empty deleteMsg}">
    <script>
        alert("${deleteMsg}");
    </script>
    <%
        request.removeAttribute("deleteMsg");
    %>
</c:if>
<c:if test="${updateMsg != null && !empty updateMsg}">
    <script>
        alert("${updateMsg}");
    </script>
    <%
        request.removeAttribute("updateMsg");
    %>
</c:if>
<c:if test="${addMsg != null && !empty addMsg}">
    <script>
        alert("${addMsg}");
    </script>
    <%
        request.removeAttribute("updateMsg");
    %>
</c:if>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>查询所有管理员</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="table_data_tables.html#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="table_data_tables.html#">选项1</a>
                            </li>
                            <li><a href="table_data_tables.html#">选项2</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">

                    <table class="table table-striped table-bordered table-hover dataTables-example">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>姓名</th>
                            <th>账户名</th>
                            <th>联系方式</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                            <c:forEach items="${adminList}" var="admin">
                                <tr>
                                    <td>${admin.id}</td>
                                    <td>${admin.name}</td>
                                    <td>${admin.username}</td>
                                    <td>${admin.telephone}</td>
                                    <td>
                                        <a class="btn btn-info btn-xs" onclick="toUpdate(${admin.id})">修改</a>&nbsp;&nbsp;&nbsp;
                                        <a class="btn btn-danger btn-xs" onclick="toDelete(${admin.id})">删除</a>
                                    </td>
                                </tr>
                            </c:forEach>
                        </tbody>
                        <tfoot>
                        <tr>
                            <th>ID</th>
                            <th>姓名</th>
                            <th>账户名</th>
                            <th>联系方式</th>
                            <th>操作</th>
                        </tr>
                        </tfoot>
                    </table>

                </div>
            </div>
        </div>
    </div>
</div>
<script src="<%=application.getContextPath()%>/static/js/jquery.min.js?v=2.1.4"></script>
<script src="<%=application.getContextPath()%>/static/js/bootstrap.min.js?v=3.3.5"></script>
<script src="<%=application.getContextPath()%>/static/js/plugins/jeditable/jquery.jeditable.js"></script>
<script src="<%=application.getContextPath()%>/static/js/plugins/dataTables/jquery.dataTables.js"></script>
<script src="<%=application.getContextPath()%>/static/js/plugins/dataTables/dataTables.bootstrap.js"></script>
<script src="<%=application.getContextPath()%>/static/js/content.min.js?v=1.0.0"></script>
<script>
    $(document).ready(
        function(){
            $(".dataTables-example").dataTable();
            }
    );
    // 确定要删除吗？
    function toDelete(id) {
        let flag = confirm("确定要删除吗？")
        if (flag) {
            window.location.href = "http://localhost:8080/ssm/admin/deleteAdmin?id="+id;
        }
    }

    // 确定要修改吗？
    function toUpdate(id) {
        // let flag = confirm("确定要修改吗?");
        // if (flag) {
        //     window.location.href = "http://localhost:8080/ssm/admin/toUpdate?id="+id;
        // }
        window.location.href = "http://localhost:8080/ssm/admin/toUpdate?id="+id;
    }
</script>
<script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>

</body>

</html>
